package jee.boot.module.sms.interceptor;


import jee.boot.common.standard.AccountHandler;
import jee.boot.common.utils.SpringContextHolder;
import jee.boot.entity.sms.Sms;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Date;

/**
 * 默认的短信发送前置处理
 *
 * @author zhilei.wang
 */
public class DefaultSmsPreInterceptor implements SmsInterceptor {
    private Log log = LogFactory.getLog(DefaultSmsPreInterceptor.class);

    @Override
    public void process(Sms sms) throws Exception {
        // 短信发送前,对数据进行预处理
        sms.setSendUser(SpringContextHolder.getApplicationContext().getBean(AccountHandler.class).getPrincipal());
        sms.setSendDate(new Date());

    }

}
